/**
 * Created by binggan on 2018/1/22.
 */
function isMobile(){
    return (
        (navigator.userAgent.match(/Android/i)) ||
        (navigator.userAgent.match(/webOS/i)) ||
        (navigator.userAgent.match(/iPhone/i)) ||
        (navigator.userAgent.match(/iPod/i)) ||
        (navigator.userAgent.match(/iPad/i)) ||
        (navigator.userAgent.match(/BlackBerry/))
    );
};
$(function(){
    //相关推荐定位
   var goalHeight=20;
    if(!isMobile()){
        $(window).scroll(function(){
            var scrTop=$(this).scrollTop();
            if(scrTop>=goalHeight){
                $('.news-recommend').addClass('news-recommend-fixed');
            }else{
                $('.news-recommend').removeClass('news-recommend-fixed');
            }

        })
    }

    //小屏幕导航菜单
    var $meu_btn=$(".menu-button");
    $meu_btn.on('click',function(e){
        e.stopPropagation();
        $(".header-box,.container").toggleClass('navOpen');
    })
    $(document).on('click',function(e){
        $(".header-box,.container").removeClass('navOpen');
    })

})
